<!DOCTYPE html>
<html>
  
  <head>
    <meta charset="UTF-8">
    <title>扫描类型列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="/css/font.css">
    <link rel="stylesheet" href="/css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  
  <body>
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">设备</a>
        <a>
          <cite>扫描类型列表</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body">

      <table class="layui-table">
        <thead>
          <tr>
            <th>类型码</th>
            <th>类型名</th>
            <th>操作</th>
        </thead>
        <tbody id="data-body">
          <tr>
            <td>1</td>
            <td>admin</td>
            <td>18925139194</td>
            <td>超级管理员</td>
            <td>2017-01-01 11:11:42</td>
          </tr>
        </tbody>
      </table>

    </div>
    <script>

      // 获取从设备列表传递过来的主板ID
      let boardId = "[[${#request.getParameter('boardId')}]]";

      
      /*查询数据的方法*/
      function getPageData(page,pageSize){

        // 传递的数据 => boardId

        // 获取数据列表
        $.ajax({
          type:"post",
          url:"/scan/type/list",
          data: {boardId: boardId},
          dataType:"json",
          success:function (data) {
            console.log(data);

            if(data.code === 200){
              // 清空数据
              $("#data-body").empty();
              // 遍历数据的数组,生成对应的行
              $(data.data).each(function () {
                // 创建数据行的dom对象
                let tr = $('<tr>\n' +
                        '            <td>'+this.typeCode+'</td>\n' +
                        '            <td>'+this.typeName+'</td>\n' +
                        '            <td class="td-manage">\n' +
                        '              <a title="扫描列表数据-'+this.typeName+'" class="open_new_tab" _href="/scan/data/list/page?boardId='+boardId+'&typeCode='+this.typeCode+'" href="javascript:;">\n' +
                        '                <i class="layui-icon">&#xe66b;</i>\n' +
                        '              </a>\n' +
                        '            </td>\n' +
                        '          </tr>');
                // 将数据追加到 tbody中
                $("#data-body").append(tr);

              });


            }

          }
        });
      }

      /**
       * 让整个dom文档加载完之后再执行
       */
      $(function () {
        getPageData(0,0);
      })
    </script>

  </body>

</html>